package cn.wolfcode.crm.web.controller;

import cn.wolfcode.crm.domain.SystemLog;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.serivce.ISystemLogService;
import cn.wolfcode.crm.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("systemLog")
public class SystemLogController {
    @Autowired
    private ISystemLogService service;

    @RequestMapping("view")
    public String view() throws Exception {
        return "systemLog";
    }

    @RequestMapping("listAll")
    @ResponseBody
    public List<SystemLog> listAll() throws Exception {
        List<SystemLog> systemLogs = service.selectAll();
        return systemLogs;
    }
    @RequestMapping("deleteAll")
    @ResponseBody
    public JSONResult deleteAll(){
        try{
            service.deleteAll();
            return new JSONResult();
        }catch (Exception e){
            e.printStackTrace();
            return new JSONResult().mark("操作失败");
        }

    }

}
